
function swit(url) {
    wx.navigateTo({
        url: url,
        success: function (res) {
            // success
        },
        fail: function () {
            // fail
            toast("跳转失败!");
        },
        complete: function () {
            // complete
        }
    })
}

function switClose(url) {
    wx.redirectTo({
        url: url,
        success: function (res) {
            // success
        },
        fail: function () {
            // fail
            toast("跳转失败!");
        },
        complete: function () {
            // complete
        }
    })
}

function back(delta) {
    wx.navigateBack({
        delta: delta, // 回退前 delta(默认为1) 页面
        success: function (res) {
            // success
        },
        fail: function () {
            // fail
            toast("回退失败!");
        },
        complete: function () {
            // complete
        }
    })
}

function toast(msg) {
    wx.showToast({
        title: msg,
        duration: 1000
    });
}

module.exports = {
    swit: swit,
    switClose: switClose,
    back:back
}